
**********************************************************************************************************************************
** title:		The Role of Education on Political Information Processing and Correct Voting : Inequality at the Voting Booth?	**									
** authors:		Silke Goubin, Richard Lau, Dieter Stiers, Marc Hooghe 															** 
** data set:	Data_replication_ANES																							**
** date:		November 2024																									**
**********************************************************************************************************************************

set more off
set scheme s1mono

*** Load data ***
use Data_replication_ANES.dta

*****************
**Main analyses**
*****************

***Main models explaining correct voting (Table 1)
//Model without sophistication
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. , cluster(year)

//Model with sophistication
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)


***********************
**Additional analyses**
***********************

***Descriptives of the estimation sample (Appendix A)
	//Create estimation sample
	regress CorrVtWM education income age i.gender i.race i.PartyID pidstrength sophistication
tab CorrVtWM if e(sample)
tab gender if e(sample)
tab race if e(sample)
tab PartyID if e(sample)
sum education income age sophistication pidstrength if e(sample)


***Causal mediation model (Appendix F)
medeff (regress sophistication education income age gender racedummy2 racedummy3 racedummy4 partyIDdummy2 partyIDdummy3 pidstrength) ///
(logit CorrVtWM sophistication education income age gender racedummy2 racedummy3 racedummy4 partyIDdummy2 partyIDdummy3 pidstrength) ///
, mediate(sophistication) treat(education 1 4)


***Interaction education-sophistication (Appendix G)
//Model including the interaction term (Table G.1)
logit CorrVtWM c.education##c.sophistication income age i.gender i.race i.PartyID pidstrength i.year , cluster(year)

//Figure showing marginal effect of sophistication by level of education (Figure G.1)
margins, dydx(sophistication) at(education=(1(1)4)) post
coefplot,  xline(0, lcol(gs0)) level(95 90) coeflabels(1._at = "Grade school or less" 2._at = "High school" 3._at = "Some college" 4._at = "College or advanced ") scale(*1.6) xsize(7) xtitle("Marginal effect of sophistication, by level of education", size(small))


***Binary education variable (Appendix H)
logit CorrVtWM i.education_binary income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. , cluster(year)
logit CorrVtWM i.education_binary income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)


***Including 2000 (Appendix I)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength i.year if sophistication_inc_2000~=. , cluster(year)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength sophistication_inc_2000 i.year , cluster(year)
	

***Including campaign exposure (Appendix J)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength campaign i.year if sophistication~=. , cluster(year)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength campaign sophistication i.year , cluster(year)

	
***Alternative measures educational level (Appendix K)
*Explaining correct voting
logit CorrVtWM education_6 income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. , cluster(year)
logit CorrVtWM education_6 income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)
logit CorrVtWM education_7 income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. , cluster(year)
logit CorrVtWM education_7 income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)
	

***Measurement knowledge and sophistication (Appendix L)
factor knowledge_1_alt knowledge_2_alt knowledge_3_alt knowledge_4_alt
alpha knowledge_1_alt knowledge_2_alt knowledge_3_alt knowledge_4_alt
tetrachoric knowledge_1_alt knowledge_2_alt knowledge_3_alt knowledge_4_alt

factor interest knowledge_alt watchnews polpart
alpha interest knowledge_alt watchnews polpart
corr interest knowledge_alt watchnews polpart

***Multilevel models correcting for state (Appendix M)
melogit CorrVtWM education income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. || state:
melogit CorrVtWM education income age i.gender i.race i.PartyID pidstrength sophistication i.year  || state:


***Step-by-step analysis (Appendix N)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength i.year if sophistication~=. , cluster(year)
margins, dydx(education)
marginsplot, scheme(s1mono) title(Model 1) xtitle("") xlabel(,tlc(white)) ytitle("AME educational level") name(F1,replace)
logit CorrVtWM income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)
margins, dydx(sophistication)
marginsplot, scheme(s1mono) title(Model 2) xtitle("") xlabel(,tlc(white)) ytitle("AME political sophistication") name(F2,replace)
logit CorrVtWM education income age i.gender i.race i.PartyID pidstrength sophistication i.year , cluster(year)
margins, dydx(education sophistication)
marginsplot, scheme(s1mono) title(Model 3) xtitle("") xlabel(1 "Educational Level" 2 "Political sophistication") xscale(range(0.7 2.3)) ytitle("AME") recast(scatter) name(F3,replace)
//Combine figure
graph combine F1 F2 F3 , scheme(s1mono) ycommon r(1) xsize(9)

